#ifndef _ERR_CODE_H_
#define _ERRO_CODE_H_


#define MK_ERR_CODE(nMajorModuleID, nMinorModuleID, nErrCodeInMinorModule) \
	(((nMajorModuleID)<<24) + ((nMinorModuleID)<<16) + (nErrCodeInMinorModule))


enum ERR_CODE_SYSTEM_ENUM
{
	ERR_OK			=	MK_ERR_CODE(0,0,0),
	ERR_INIT		=	MK_ERR_CODE(0,0,1),
	ERR_NO_MEMORY	=	MK_ERR_CODE(0,0,2),
	ERR_INVALID_ARGS	= MK_ERR_CODE(0,0,3),
	ERR_TIMEOUT		= MK_ERR_CODE(0,0,4),
	ERR_SYS_FAULT	=	MK_ERR_CODE(0,,0,5),
	ERR_UPGRADE_FAULT	= MK_ERR_CODE(0,0,6),
	ERR_RECOVER_FAULT	= MK_ERR_CODE(0,0,7)
};

enum MAJOR_MODULE_ENUM
{
	MOD_SYS		=		0,
	MOD_PUB		=		MOD_SYS
};


enum MOD_PUB_MODULE_ENUM
{
	MOD_PUB_GENERAL		=	0,
	MOD_PUB_THREAD		=	1,
	MOD_PUB_TIMER		=	2,
	MOD_PUB_QUEUE		=	3,
	MOD_PUB_MUTEX		=	4
};


enum ERR_CODE_PUB_MODULE_ENUM
{
	ERR_THREAD_OK				=	ERR_OK,
	ERR_THREAD_INVALID_HANDLE	=	MK_ERR_CODE(MOD_PUB, MOD_PUB_THREAD, 1),
	ERR_THREAD_MSG_EMPTY		=	MK_ERR_CODE(MOD_PUB, MOD_PUB_THREAD, 2),
	ERR_THREAD_MSG_FULL			=	MK_ERR_CODE(MOD_PUB, MOD_PUB_THREAD, 3),
	ERR_THREAD_INIT_MANAGER		=	MK_ERR_CODE(MOD_PUB, MOD_PUB_THREAD, 4),
	ERR_RHREAD_EXIT_MANAGER		=	MK_ERR_CODE(MOD_PUB, MOD_PUB_THREAD, 5),
	ERR_THREAD_STILL_RUNNING	= 	MK_ERR_CODE(MOD_PUB, MOD_PUB_THREAD, 6),
	ERR_THREAD_KILLED			=	MK_ERR_CODE(MOD_PUB, MOD_PUB_THREAD, 7)
};

#endif
